package salesSystem;

import salesSystem.Service.OrderService;
import salesSystem.model.Order;
import salesSystem.model.OrderItem;

import java.util.List;
import java.util.Arrays;

//只完成了订单管理部分内容
public class salesManagementSystem {
    public static void main(String[] args) {
        // 初始化订单服务
        OrderService orderService = new OrderService();

        // 创建订单项
        OrderItem item1 = new OrderItem("P1001", "笔记本电脑", 1, 5999.00);
        OrderItem item2 = new OrderItem("P1002", "无线鼠标", 2, 99.50);
        List<OrderItem> items = Arrays.asList(item1, item2);

        // 1. 创建订单
        Order order = orderService.createOrder("CUST001", items, "北京市海淀区中关村大街1号");
        String orderId = order.getOrderId();

        // 2. 审核订单
        orderService.approveOrder(orderId);

        // 3. 处理支付
        orderService.processPayment(orderId, "支付宝");

        // 4. 准备订单（检查库存）
        orderService.prepareOrder(orderId);

        // 5. 发货
        orderService.shipOrder(orderId);

        // 6. 查询订单状态
        Order currentOrder = orderService.getOrder(orderId);
        System.out.println("当前订单状态: " + currentOrder.getStatus());

        // 7. 订单完成
        orderService.completeOrder(orderId);

        // 打印最终订单信息
        System.out.println("\n最终订单信息:");
        System.out.println("订单ID: " + currentOrder.getOrderId());
        System.out.println("状态: " + currentOrder.getStatus());
        System.out.println("总金额: " + currentOrder.getTotalAmount());
        System.out.println("物流单号: " + currentOrder.getTrackingNumber());
    }
}